package com.yonyou.cyxdms.sysAuth.service.mapper;

import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.sysAuth.service.entity.UserOrgPO;
import com.yonyou.cyxdms.sysAuth.service.vo.user.UserPermissionCtrlVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户职位表 Mapper 接口
 * </p>
 *
 * @author 李贺
 * @since 2019-09-18
 */
public interface UserOrgMapper extends SuperMapper<UserOrgPO> {

    @Select("select getOwnerCodeByOrgId2( #{orgId} )")
    String findOwnerCode(@Param("orgId") Integer orgId);

    @Delete("delete from tr_user_org where user_org_id=#{userOrgId}")
    void deleteByUserOrgId(@Param("userOrgId") Long userOrgId);

    List<Integer> queryRoleByUserOrgId(@Param("userOrgId") Long userOrgId);


    /**
     * @author ：maxingjian
     * @date ：2019/11/06
     * @description：获取用户的个人参数配置
     */
    List<UserPermissionCtrlVO> getUserPermissionCtrl(@Param("userOrgId") String userOrgId,@Param("appId") String appId);

    /**
     * @author ：maxingjian
     * @date ：2019/11/22
     * @description：通过userid等获取经理id
     */
    List<String> getManagerIdByUserId(@Param("userId") String userId,@Param("positionCodes") String[] positionCodes,@Param("orgId") String orgId);

    List<Long> getUserIdByName(@Param("appId") String appId, @Param("ownerCode") String ownerCode, @Param("name") String name);

    List<Long> getUserIdByNameAndPositionCode(@Param("appId") String appId, @Param("ownerCode") String ownerCode, @Param("name") String name);
    Integer getIsConsultant(@Param("userId") Integer userId);
    Map<String,Object> getUserInfo(@Param("userId") Integer userId);
    Map<String,Object> delaultPhoneSet(@Param("dealerCode") String dealerCode);
    UserOrgPO selectByUserId(Integer userId);
    
}
